﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace btnet.pages
{
    public partial class delete_subscriber : CommonPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Bug_Util.do_not_cache(Response);

            security = new Security();
            security.check_security(HttpContext.Current, Security.MUST_BE_ADMIN);

            if (Request.QueryString["ses"] != (string)Session["session_cookie"])
            {
                Response.Write("session in URL doesn't match session cookie");
                Response.End();
            }

            string sql = "delete from bug_subscriptions where bs_bug = $bg_id and bs_user = $us_id";
            sql = sql.Replace("$bg_id", Bug_Util.sanitize_integer(Request["bg_id"]));
            sql = sql.Replace("$us_id", Bug_Util.sanitize_integer(Request["us_id"]));
            DbUtil.execute_nonquery(sql);

            Response.Redirect("view_subscribers.aspx?id=" + Request["bg_id"]);

        }
    }
}
